package com.itheima.model.vo;

import com.itheima.model.domain.UserInfo;
import com.itheima.model.mongo.Visitors;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

@Data
public class FriendsVo implements Serializable {
    private Integer id; //用户id
    private String avatar; //用户头像
    private String nickname; //昵称
    private String gender; //性别
    private Integer age; //年龄
    private String city; //城市
    private String education; //学历
    private Integer marriage; //婚姻状态
    private Integer matchRate;//匹配度
    private Boolean alreadyLove;//是否喜欢

    /**
     * 在vo对象中，补充一个工具方法，封装转化过程
     */
    public static FriendsVo init(UserInfo userInfo, Integer matchRate,Boolean alreadyLove) {
        FriendsVo vo = new FriendsVo();
        BeanUtils.copyProperties(userInfo,vo);
        vo.setMatchRate(matchRate);
        vo.setAlreadyLove(alreadyLove);
        vo.setId(Integer.valueOf(String.valueOf(userInfo.getId())));
        return vo;
    }
}
